Compare Module with string

I want to compare the column of a module with an string.

Can somebody help me ?




 m = read(modName, true)

for c in m do{

if(title(c) ==" \ " ){

print "Backslash existing"

}


sa14 - Mon Feb 02 09:07:49 EST 2015

Re: Compare Module with string
GregM_dxler - Mon Feb 02 11:44:08 EST 2015

What is your problem????

My guess is that your if statement is not correct.  Your looking to see if the column title is only a backslash.  I suspect you really want to see if a backslash is in the column title.  If this is the case, you can try the findPlainText command for the if condition

if(findPlainText(title(c), "\", off, len, false))

You will need to declare integers off and len

Hope this helps,

Greg

Re: Compare Module with string
Mike.Scharnow - Tue Feb 03 03:01:16 EST 2015

Just a wild guess; if I hit into the wrong direction, just forget this post: this seems to be about the question that bu12 posed last Friday where the "\" needed to be found not in the column title of a view but in a "module", which supposedly means that it is contained in any string or text attribute of any object.

If so, you confused columns with attributes and column title with attribute content. Columns belong to Views.

And if so, one possible approach would be:

- get a list of all attribute definitions (AttrDef) (that are of type string or text) (fill Skip list with AttrDef)

- Loop through all (not deleted) objects in a module (for objCurrent in entire m do { if isDeleted(objCurrent) then continue; ... })

- For each object check each attribute whether the "\" is contained. For this step, use the findPlainText command

- Of course you could also use columns, but that only makes sense if a) you already defined a default view that shows all attributes and objects you are interested in or b) load such a view after opening the module, before looping through the objects.

 

Just a hint: if you have problems with confusing things like columns and attributes, it's probably a good idea to go back to the DOORS manual, make sure that all the concepts are thoroughly understood and only then try to start with DXL, otherwise the results you get might be very surprising.

Again: Please take no offense if I misunderstood your question and your background.

Best regards,
Mike

Re: Compare Module with string
Mike.Scharnow - Tue Feb 03 05:12:11 EST 2015

You need to escape the \ character with another \ character to get rid of \'s special meaning in strings. See the section "Character constants" in the help.

In this case this means: string sz= "\\".

Keep in mind that "for o in m" will not find any objects which are currently not visible e.g. because of a filter. The approach "for o in entire m" (see post above) is generally safer.

Re: Compare Module with string
Mike.Scharnow - Tue Feb 03 05:18:50 EST 2015

Oh, and please try to be more specific in your questions.

You only said that you want to find a backslash (or other characters) "in a module".
From this statement it is not clear what is "in a module"?

What I thought you mean: search for "\" in any string/text attribute in any object
What you programmed in your first attempt: search for "\" in name of a column in a default view
What you programmed in this posting before you edited it: search for "\" in the name of a module - but in DOORS it's not even possible to create a module called "this\is\a\module" or "this/is/also/a/module"
What you programmed now: search for "\" only in the Object Text of all currently visible objects

Then you asked whether you were on the right track. How can we know if don't explain how your goal looks like?

BR,
Mike